# from django.views.generic import View
# class Index(View):
#     def get(self, request):
#         return HttpResponse("hello")
#     # 如果没有get但是却用get
#     def http_method_not_allowed(self, request):
#         return HttpResponse("meizhaodao")

# 无论get或者post,都经过dispath
# def dispatch(self, request, *args, **kwargs):
#     return HttpResponse("必须经过我")

# from django.views.generic import TemplateView
# 无需经过view,直接渲染html页面
# 如果需要传递参数
# class About(TemplateView):
#     template_name = 'add.html'
#
#     def get_context_data(self):
#         context = {}
#         return context

# from django.views.generic import ListView
# class Article(ListView):
#     model = "Article"
#     template_name = "add.html"
#     context_object_name = "articles"
#     paginate_by = 10
#     ordering = 'id'
#     page_kwarg = 'page'
# def get_context_data(self, *, object_list=None, **kwargs):
#     content = super(Article, self).get_context_data()
#
#     return content
# def get_queryset(self):
#     return Article.object.filter()


# 分页
# Paginator
# paginator = content.get('paginator')
# page = content.get('page_obj')
# has_next() ：是否还有下一页。
#
# has_previous() ：是否还有上一页。
#
# next_page_number() ：下一页的页码。
#
# previous_page_number() ：上一页的页码。
#
# object_list ：在当前这页上的对象列表。
#
# number ：当前的页码。
#
# paginator ：获取 Paginator 对象。


# 类试图添加装饰器
